package com.core.website.service.impl;

import com.core.website.entity.ContentType;
import com.core.website.mapper.ContentTypeMapper;
import com.core.website.service.ContentTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

@Service
public class ContentTypeServiceImpl implements ContentTypeService {
    @Autowired
    private ContentTypeMapper contentTypeMapper;

    @Override
    public int add(ContentType contentType) {
        contentType.setId(UUID.randomUUID().toString().toUpperCase().replace("-", ""));
        return contentTypeMapper.add(contentType);
    }

    @Override
    public int edit(ContentType contentType) {
        return contentTypeMapper.edit(contentType);
    }

    @Override
    public int delete(List<String> ids) {
        return contentTypeMapper.delete(ids);
    }

    @Override
    public List<ContentType> queryAll(ContentType contentType) {
        List<ContentType> result=contentTypeMapper.queryAll(contentType);
        return result;
    }

    @Override
    public ContentType queryOne(String id) {
        ContentType contentType=contentTypeMapper.queryById(id);
        return contentType;
    }
}
